package com.offcn.scwproject.service.Impl;

import com.offcn.scwproject.mapper.*;
import com.offcn.scwproject.pojo.*;
import com.offcn.scwproject.service.ProjectInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ProjectInfoServiceImpl implements ProjectInfoService {
    @Autowired
  private TReturnMapper tReturnMapper;
  @Autowired
  private TProjectImagesMapper projectImagesMapper;
  @Autowired
  private TProjectMapper projectMapper;
  @Autowired
  private TTagMapper tTagMapper;
  @Autowired
  private TTypeMapper tTypeMapper;
    @Override
    public List<TReturn> getReturnList(Integer id) {
        TReturnExample tReturnExample = new TReturnExample();
        tReturnExample.createCriteria().andProjectidEqualTo(id);
        return tReturnMapper.selectByExample(tReturnExample);


    }

    @Override
    public List<TProject> findProjectList() {

        return projectMapper.selectByExample(null);
    }

    @Override
    public List<TProjectImages> findProjectImageList(Integer projectId) {
        TProjectImagesExample example = new TProjectImagesExample();
        example.createCriteria().andProjectidEqualTo(projectId);
        return projectImagesMapper.selectByExample(example);

    }

    @Override
    public TProject findProjectByProjectId(Integer projectId) {

        return projectMapper.selectByPrimaryKey(projectId);
    }

    @Override
    public List<TTag> findProjectTagList() {
        return tTagMapper.selectByExample(null);
    }

    @Override
    public List<TType> findProjectTypeList() {
        return tTypeMapper.selectByExample(null);
    }

    @Override
    public TReturn findProjectReturn(Integer returnId) {
        return tReturnMapper.selectByPrimaryKey(returnId);
    }
}
